/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.aliyuncs.dt_oc_info.transform.v20220829;

import java.util.ArrayList;
import java.util.List;

import com.aliyuncs.dt_oc_info.model.v20220829.GetOcIcShareholderResponse;
import com.aliyuncs.dt_oc_info.model.v20220829.GetOcIcShareholderResponse.DataItem;
import com.aliyuncs.transform.UnmarshallerContext;


public class GetOcIcShareholderResponseUnmarshaller {

	public static GetOcIcShareholderResponse unmarshall(GetOcIcShareholderResponse getOcIcShareholderResponse, UnmarshallerContext _ctx) {
		
		getOcIcShareholderResponse.setRequestId(_ctx.stringValue("GetOcIcShareholderResponse.RequestId"));
		getOcIcShareholderResponse.setCode(_ctx.stringValue("GetOcIcShareholderResponse.Code"));
		getOcIcShareholderResponse.setSuccess(_ctx.booleanValue("GetOcIcShareholderResponse.Success"));
		getOcIcShareholderResponse.setMessage(_ctx.stringValue("GetOcIcShareholderResponse.Message"));
		getOcIcShareholderResponse.setTotalNum(_ctx.integerValue("GetOcIcShareholderResponse.TotalNum"));
		getOcIcShareholderResponse.setPageIndex(_ctx.integerValue("GetOcIcShareholderResponse.PageIndex"));
		getOcIcShareholderResponse.setPageNum(_ctx.integerValue("GetOcIcShareholderResponse.PageNum"));

		List<DataItem> data = new ArrayList<DataItem>();
		for (int i = 0; i < _ctx.lengthValue("GetOcIcShareholderResponse.Data.Length"); i++) {
			DataItem dataItem = new DataItem();
			dataItem.setStockName(_ctx.stringValue("GetOcIcShareholderResponse.Data["+ i +"].StockName"));
			dataItem.setStockType(_ctx.stringValue("GetOcIcShareholderResponse.Data["+ i +"].StockType"));
			dataItem.setStockPercent(_ctx.stringValue("GetOcIcShareholderResponse.Data["+ i +"].StockPercent"));
			dataItem.setShouldCap(_ctx.stringValue("GetOcIcShareholderResponse.Data["+ i +"].ShouldCap"));
			dataItem.setShouldCapTime(_ctx.stringValue("GetOcIcShareholderResponse.Data["+ i +"].ShouldCapTime"));

			data.add(dataItem);
		}
		getOcIcShareholderResponse.setData(data);
	 
	 	return getOcIcShareholderResponse;
	}
}